package com.lwq.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * Description:
 * Author: LiuWenQing
 * Datetime: 2021/6/14
 */
@WebListener
public class TaskExectorStopListener implements ServletContextListener {

    @Autowired
    private ThreadPoolTaskExecutor taskExecutor;

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        taskExecutor.shutdown();
    }
}
